﻿using System;


namespace RuTracker.Interface.Dropbox
{
    [Serializable]
    public class StorageFile : IStorageItem
    {
        public StorageFile(string name, IStorageItem parent)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            Parent = parent;
            Name = name;
        }

        public IStorageItem Parent { get; private set; }
        public string Name { get; private set; }

        public string FullName
        {
            get { return ToString(); }
        }


        public override string ToString()
        {
            string parentFullName = Parent == null ? string.Empty : Parent.ToString();
            if (Parent == null)
            {
                return string.Format("/{0}", Name);
            }
            return string.Format("{0}{1}", parentFullName, Name);
        }
    }
}
